﻿#ifndef WIDGETTITLE_H
#define WIDGETTITLE_H

#include <QWidget>
#include <QToolButton>
#include <QPushButton>
#include <QLabel>
#include "QTranslator"
#include <QMenu>
#include <QAction>
#include "Widget.h"
#include "Label.h"
#include "LineEditNum.h"
#include "PushButtonSystem.h"
#include "PushButtonSwitch.h"
#include "PushButtonChoose.h"
#include "PushButtonSwitchText.h"
#include "PushButtonTitle.h"
#include "PushButtonChoose.h"
#include "DialogPop.h"
#include "ResizeBase.h"
#include <QTimer>
#include "Combobox.h"
#include <QMenu>
#include <QAction>
#define TITLE_BUTTON_SIZE 32
class WidgetTitle : public Widget
{
    Q_OBJECT
public:
    explicit WidgetTitle(QWidget *parent = nullptr);

protected:

    virtual void mouseDoubleClickEvent(QMouseEvent *event);

    virtual void mousePressEvent(QMouseEvent *event);

    virtual void mouseMoveEvent(QMouseEvent *event);

    virtual void mouseReleaseEvent(QMouseEvent *event);

    virtual bool eventFilter(QObject *obj, QEvent *event);

    void updateMaximize();

private:

    PushButtonTitle* m_minimizeButton;
    PushButtonTitle* m_maximizeButton;
    PushButtonTitle* m_closeButton;

    PushButtonTitle* m_optButton;


    bool m_leftButtonPressed;
    QPoint m_start;
    QPoint m_end;

    /*时间*/
    Label* m_labelTime;
    QTimer* m_timer;


    /*选项功能菜单*/
    QMenu* m_menuOpt;
    QAction* m_action_1;
    QAction* m_action_2;
    QAction* m_action_3;
   /*双击按键*/
    bool  isDouble;
signals:
    /*功能分页被点击*/
    void evt_pushbuttonFuncClick(int widgetID);
    /*子功能栏使能按钮被点击*/
    void evt_pushbuttonFuncChildClick(int value);

    /*管理员按钮被点击*/
    void evt_pushbuttonAdminClick(int value);

    /*标题栏隐藏*/
    void evt_titleHideChanged();

    /*父窗体被移动了*/
    void evt_moveParentWidget();

    /*显示二维码配置窗口*/
    void evt_showWidgetQRcode();
public slots:
    /*最大最小化关闭*/
    void on_titleButtonClick();

    /*时间*/
    void on_systemTimeOut();



    /*软件版本号*/
    void on_action_1();

    /*软件升级*/
    void on_action_2();

    /*二维码配置*/
    void on_action_3();

    /*语言切换*/
    void on_action_4();
};

class WidgetTitle_dialog : public Widget
{
    Q_OBJECT
public:
    explicit WidgetTitle_dialog(QWidget *parent = nullptr);

    void hideAllChildren(bool flag = true);

    //     virtual void resetLayout();

    PushButtonSwitch* getAdminMenuButton();

protected:
    //    void resizeEvent(QResizeEvent *event);

    virtual void mouseDoubleClickEvent(QMouseEvent *event);

    virtual void mousePressEvent(QMouseEvent *event);

    virtual void mouseMoveEvent(QMouseEvent *event);

    virtual void mouseReleaseEvent(QMouseEvent *event);

    virtual bool eventFilter(QObject *obj, QEvent *event);


    void updateMaximize();

private:

    PushButtonTitle* m_minimizeButton;
    PushButtonTitle* m_maximizeButton;
    PushButtonTitle* m_closeButton;

    PushButtonTitle* m_refrushButton;
    QAction* m_action_1;
    bool m_leftButtonPressed;
    QPoint m_start;
    QPoint m_end;



    /*管理员按钮*/
    PushButtonSwitch* m_pushbuttonAdmin;

signals:
    /*功能分页被点击*/
    void evt_pushbuttonFuncClick(int widgetID);
    /*子功能栏使能按钮被点击*/
    void evt_pushbuttonFuncChildClick(int value);

    /*管理员按钮被点击*/
    void evt_pushbuttonAdminClick(int value);

    /*标题栏隐藏*/
    void evt_titleHideChanged();
public slots:
    /*最大最小化关闭*/
    void on_titleButtonClick();



    /*管理员按钮被点击*/
    void on_pushbuttonAdminClick();






};
#endif 
